<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@include file="../common/tag.jsp"%>
<div class="list-group">
    <c:forEach items="${thisWeek}" var="wd">
        <div class="list-group-item
        <c:if test="${wd.weekIndex == todayIndex}"> active</c:if>
        <c:if test="${wd.weekIndex > todayIndex}"> disabled</c:if>
        ">
            <h4 class="list-group-item-heading">
                ${wd.dayName}
            </h4>
            <c:if test="${wd.weekIndex <= todayIndex}">
                <c:if test="${wd.dailyNote != null}">
                    <p class="list-group-item-text">
                            ${wd.dailyNote.comment}
                        日期 <fmt:formatDate value="${wd.dailyNote.generateDate}" pattern="yyyy年MM月dd日hh点mm分"/>
                    </p>
                    <a style="color: #080808;cursor:pointer;" onclick="dailyDetail(${wd.dailyNote.id})">查看详情 »»</a>
                </c:if>
                <c:if test="${wd.dailyNote == null}">
                    <a style="color: #080808;cursor:pointer;" onclick="writeDaily(${wd.weekIndex})">写日志 »»</a>
                </c:if>
            </c:if>

        </div>
    </c:forEach>
</div>
<script type="application/javascript">
    function dailyDetail(id){
        home.b.getDailyById(id);
    }
    function writeDaily(weekIndex){
        $.ajax({
            type:"GET",
            url:"/t/n/"+weekIndex+"/writeDaily",
            data:{},
            dataType:"html",
            success: function (result) {
                $("#home_c").html("");
                $("#home_c").html(result);
            }
        });

    }
</script>